package com.keter.framework.persist;

import com.jfinal.ext.proxy.CglibProxyFactory;
import com.jfinal.proxy.ProxyManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * 初始化配置:使调用方无需包扫描条件下Autowired自动生效
 */
@Configuration
@ComponentScan(basePackages = {"com.keter.framework.persist"})
public class AutoConfiguration {
    private static final Logger logger = LoggerFactory.getLogger(AutoConfiguration.class);


    @Autowired
    private void initProxy(){
        logger.info("设置JFinal动态代理...");
        // 兼容性处理：解决Jfinal动态代理导致程序包com.jfinal.aop不存在问题
        ProxyManager.me().setProxyFactory(new CglibProxyFactory());
    }

}
